  {  Petrova Tatjana
     2012/10/21
     This program writes pi.}

program Number;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  N1,N2,i: integer;
  x,y:double;
  d,b:real;
  fin :Textfile ;
begin
  randomize;
  assignFile(fin, 'Table.txt');
  rewrite(fin);
  N1:=0;
  N2:=0;
  for i:=1 to 10*10*10*10*10*10 do
  begin
    y:=2*random;
    x:=2*random;
    if (((x-1)*(x-1)+(y-1)*(y-1))<=1) then
    begin
      N1:=N1+1;
      N2:=N2+1
    end else
      N1:=N1+1;
    if ((N1 mod 1000)=0) then
    begin
      d:=4*(N2/N1);
      b:=pi-d;
      writeln(fin,N1,' ',b:0:5);
     
    end;
  end;
  closeFile(fin);



end.
